Skip to content

Fix validate_chain_list() colnames check to compare all chains#529

Merged
jgabry merged 6 commits intostan-dev:masterfrom
utkarshpawade:fix/validate-chain-list-colnames-check
Apr 15, 2026
Merged

Fix validate_chain_list() colnames check to compare all chains#529
jgabry merged 6 commits intostan-dev:masterfrom
utkarshpawade:fix/validate-chain-list-colnames-check

Conversation

@utkarshpawade
Copy link
Copy Markdown
Contributor

Fixes #528

  • Fixed bug where identical(cnames[, 1], cnames[, 2]) only validated colnames of chains 1 and 2, silently ignoring mismatches in chains 3+
  • Replaced sapply with lapply + vapply to avoid matrix/list type ambiguity and compare all chains against the first

Copilot AI review requested due to automatic review settings April 7, 2026 08:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes validate_chain_list() so column-name consistency is validated across all chains (not just chains 1 and 2), preventing silent acceptance of mismatched parameter names/order in chains 3+.

Changes:

  • Replaced sapply(x, colnames) simplification logic with lapply(x, colnames) to avoid matrix/list ambiguity.
  • Updated the equality check to compare every chain’s colnames() against chain 1 via vapply(..., identical, ...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/helpers-mcmc.R
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (14c1c74) to head (8637e82).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #529      +/-   ##
==========================================
- Coverage   99.18%   99.18%   -0.01%     
==========================================
  Files          35       35              
  Lines        6120     6118       -2     
==========================================
- Hits         6070     6068       -2     
  Misses         50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a good fix and the code is even cleaner than the original.

@jgabry jgabry merged commit 9d6a95b into stan-dev:master Apr 15, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate_chain_list() only compares colnames of chains 1 and 2, ignoring chains 3+

4 participants